package mystia.lorelei.app.service;

import jakarta.annotation.Resource;
import mystia.lorelei.app.entity.Cuisine;
import mystia.lorelei.app.repository.CuisineRepository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CuisineService {
    @Resource
    private CuisineRepository cuisineRepository;

    public List<Cuisine> listCuisines() {
        return cuisineRepository.findAll();
    }

    public void saveCuisine(Cuisine cuisine) {
        cuisineRepository.save(cuisine);
    }
    
    public void deleteCuisine(int id){
        cuisineRepository.deleteById(id);
    }
    public void deleteCuisines(List<Integer> ids) {cuisineRepository.deleteAllByIds(ids);}
    public Cuisine queryCuisine(int id){return cuisineRepository.findById(id).orElse(null);}
    
}
